package cn.edu.hunau.java.week02.day04.Student;

import org.junit.Test;

import java.util.Arrays;

public class StudentTest {

    @Test
    public void testStudent(){
        Student[] arrays=initData();
        Arrays.sort(arrays);
        System.out.println(Arrays.toString(arrays));
    }
    public Student[] initData(){
        Student[] array=new Student[5];
        array[0]=new Student(5394,"张麻子","计算机科学与技术");
        array[1]=new Student(494,"马邦德","互联网");
        array[2]=new Student(44,"黄四郎","计算机科学与技术");
        array[3]=new Student(24,"县长夫人","互联网");
        array[4]=new Student(424,"胡万","互联网");

        return array;
    }

    @Test
    public void StudentSortTest(){
        Student[] arrays=initData();
        Arrays.sort(arrays,(o1,o2)->o1.getName().length()-o2.getName().length());
        System.out.println(Arrays.toString(arrays));
    }
}
